﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using QAAdmin.BusinessObject;

namespace QAAdmin.UI
{
    public partial class frmUbahStatus : BaseForm
    {
        public frmUbahStatus()
        {
            InitializeComponent();
        }

        private void frmUbahStatus_Load(object sender, EventArgs e)
        {
            this.txtDocId.Text = QAController.Job.DocId;
            List<QAStatus> lstQAStatus = Enum.GetValues(typeof(QAStatus)).Cast<QAStatus>().ToList<QAStatus>();
            lstQAStatus.Remove(QAStatus.all);            
            cmbStatus.DataSource = lstQAStatus;
            cmbStatus.Focus();
            cmbStatus.Select();
        }

        private void btnOK_Click(object sender, EventArgs e)
        {
            try
            {
                this.Cursor = Cursors.WaitCursor;
                QAController.UpdateQAJob("ubah status ke " + (cmbStatus.Text.Equals("none") ? "kosong" : cmbStatus.Text), cmbStatus.Text.Equals("none") ? "" : cmbStatus.Text);

                this.DialogResult = DialogResult.OK;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }
        }
    }
}
